<?php
//var_dump($_SESSION);exit;
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 * 
 * @var bool
 */

//var_dump($_SERVER);exit;
$filename = 'index.html';
if(file_exists($filename)){
    $time = filectime($filename);
    $time = time() - $time;
    $size = filesize($filename);
    if($time > 86400 || $size < 10){
        //@unlink($filename);
        cache_index();
    }
}else{
    cache_index();
}
function cache_index(){
    $url = 'http://'.$_SERVER['HTTP_HOST'];
    $commd = isset($_GET['commd'])?$_GET['commd']:NULL;
    if($commd != 'exec'){
        $commond = 'wget -O "index.html" '.$url.'/index.php?commd=exec';
        shell_exec($commond);
    }
}
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
